package dataDraw.stateDiagramDraw;

import data.stateDiagram.State;

import java.awt.*;

/**
 * User: Szymon Kudzia
 * Date: 11.05.13
 * Time: 15:27
 */
public class GradientStateDraw extends BasicStateDraw {
	protected Color startColor;
	protected Color endColor;

	@Override
	protected void drawBackground(State state) {
		Graphics2D g2d = (Graphics2D)graphics;
		Paint p = g2d.getPaint();

		int posX = state.getPosition().getX();
		int posY = state.getPosition().getY();
		int sizeW = state.getPosition().getWidth();
		int sizeH = state.getPosition().getHeight();

		GradientPaint dp = new GradientPaint(posX, posY, startColor,
				posX + sizeW, posY + sizeH, endColor);
		g2d.setPaint(dp);

		g2d.fillRoundRect(posX, posY, sizeW, sizeH, 10, 10);

		g2d.setPaint(p);

		super.drawBackground(state);
	}

	public void setStartColor(Color startColor) {
		this.startColor = startColor;
	}

	public void setEndColor(Color endColor) {
		this.endColor = endColor;
	}
}
